Skip to content

feat(storybook): build out Code Editors pattern pages - #1111

Merged
dbacomputer merged 3 commits into
mainfrom
code-editors-patterns-docs
Sep 24, 2026
Merged

dbacomputer merged 3 commits into
mainfrom
code-editors-patterns-docs

Conversation

@dbacomputer

@dbacomputer dbacomputer commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Builds out a full "Apollo Wind > Patterns > Code Editors" documentation section covering how to compose Monaco and CodeMirror across the app. It also aligns every exported editor theme with the current apollo-core tokens, including the Future Light tokens promoted in #1204, and fixes several real bugs found along the way.

Rebased onto main after #1204. This PR is three commits:

  1. fix(apollo-wind): align editor themes with apollo-core tokens
  2. fix(apollo-react): disambiguate Node Property Panel editor story names
  3. feat(storybook): build out the Code Editors pattern pages

Editor themes (@uipath/apollo-wind/editor-themes)

  • Future token values: the Future Dark and Future Light Monaco/CodeMirror themes hardcoded Tailwind v3 hex, while apollo-core ships Tailwind v4 values for the same steps (for example zinc-400 #a1a1aa vs #9f9fa9, cyan-400 #22d3ee vs #00d3f2). Every Future value now uses the apollo-core hex for the step it already names, so syntax colors match the --code-* tokens exactly. Step choices are unchanged. Classic and HC themes already matched.
  • Future Dark CodeMirror background: zinc-900 to zinc-800, matching Monaco. Future Light already matches at white via feat(apollo-core): promote Future Light theme tokens and consolidate UX Inventory docs #1204.
  • Future Dark popups: suggest, hover, and widget backgrounds use surface-overlay (zinc-800) instead of zinc-950, the page background, matching Future Light. Selected suggest rows use background-selected in both Future themes.
  • Suggest widget text, all six Monaco themes: none of the themes set suggest foregrounds, so Monaco fell back to its defaults. In Future Light that meant white text on the selected row (unreadable), and every theme used a stock blue match highlight in place of its own accent.
  • Bracket pairs, all six Monaco themes: brackets used Monaco's default gold/orchid/blue colorization. They now use each theme's punctuation color, matching CodeMirror, with error-text for unexpected brackets.

New pages

  • Editor Full / Editor Compact / Editor Input: reference layouts for full, compact, and mode-switching (text ⇄ code) editors.
  • Editor Variables: binding a variable into an editor two ways, a VariablePicker "Insert" dropdown or typing $ in the editor. Covers both PromptEditor (ref-based insertVariableToken) and Monaco (cursor-position insert via editor.executeEdits, the same pattern used in NodePropertyPanel's panel composition stories).
  • Layout Pattern: a canvas-panel example built on the shared FullWorkbenchComposition template, which gains an optional renderRightPanel prop so other pattern pages can supply their own panel. The panel header matches the other workbench panels (node icon, no header action). The expression takeover uses the same Modal + ModalContent variant="takeover" pattern as the shared node takeover (not the deprecated CanvasTakeoverModal), opens straight into fullscreen, and has Run in its header as a secondary button.

Bugs fixed along the way

  • Monaco's TS diagnostics flagged undeclared identifiers in these illustrative snippets as errors. Semantic validation is disabled; syntax validation stays on so malformed code still surfaces. Monaco's TypeScript defaults are global, so the demo settings apply only while a demo editor is mounted and the previous defaults are restored when the last one unmounts; other stories keep their own diagnostics. Demo models now use a unique .tsx URI with JSX enabled, since the full sample is a React component and every JSX line was reported as a syntax error.
  • LiveMonacoEditor forwarded value via defaultValue, so external updates to an already-mounted controlled editor were ignored. It is now controlled when a caller passes onChange and uncontrolled otherwise, so static samples can't reconcile a constant value over user edits. The Monaco input and Editor Variables demos keep their expression in state, so code-mode edits and inserted variables survive re-renders and mode switches. The CodeMirror editors (the input demo and LiveCodeMirrorEditor) rebuild their view on theme changes from the live document instead of the original sample or a keyed remount, so edits survive a theme switch.
  • The Input Editor's lockable-field example had a fixed 84px editor inside a 36px input row, which covered the field label, and later a nested bordered box inside the borderless Future field. It now mounts Monaco borderless in the field's own row, like NodePropertyPanel's inline editor, with a placeholder in the same position and font as the built-in expression input. Its label goes through the label slot as a styled Label; a plain string rendered unstyled. The field's id, aria-*, and data-slot are forwarded to Monaco's focus element, and the editor is named via ariaLabel, so validation and InputGroup focus styling reach it. Clicking the field label focuses the editor, since a label can't activate Monaco's EditContext div.
  • The Monaco and CodeMirror input demos forced a bg-surface-overlay fill (gray in Classic Light, unlike the default field) and had different code-mode treatments. Both now use the default InputGroup fill and share one code mode: header, no line numbers, wrapping, height, type size, and the Future field radius.
  • CodeMirror's base styles overrode our theme font-family on .cm-content, so CodeMirror editors rendered in the browser's generic monospace font instead of Apollo's font stack. Fixes every CodeMirror instance in this file.
  • Editor Full/Compact and the Themes page compared Monaco against CodeMirror at mismatched heights, since CodeMirror auto-sizes to its content. Both now share an explicit height.

Other changes

  • Renamed Node Property Panel's "Editor Full" / "Editor Compact" / "Editor Inline" stories to "Panel: Full Editor" / "Panel: Compact Editor" / "Panel: Inline Editor". They collided in name with the new Code Editors pages, making both sets hard to tell apart in search and the sidebar.
  • Added Patterns > [Layout Patterns, Code Editors] to Storybook's storySort so the new section has a stable sidebar position.
  • Field Type guidance links its "LockableValueField, insert variable" section, plus the insert-variable and inline-autocomplete audit rows, to Code Editors: Editor Variables for the code editor implementation.
  • Flow.stories.tsx: applied Biome's safe import-order fix, which was already failing on main.

Test plan

  • biome check clean on all changed files
  • turbo run typecheck clean for apollo-wind, apollo-react, storybook-app
  • Verified in a running Storybook that Future Dark/Light editor colors resolve to the same hex as the live --code-*, surface-overlay, and background-selected tokens
  • Opened Monaco autocomplete in all six themes: selected row text is readable and match highlights use the theme accent
  • Zero Monaco error markers on every Code Editors page; a deliberately malformed line still reports a syntax error
  • Layout Pattern renders on FullWorkbenchComposition and the expression takeover opens fullscreen, matching the shared node takeover
  • Monaco TypeScript defaults are restored after leaving the Code Editors pages and re-applied on return
  • Input Editor fields checked in Future Light and Classic Light: one outline per field, placeholder aligned with the value text, matching code modes
  • Field Type guidance links resolve to the Editor Variables story

Follow-ups (separate PRs)

  • --code-punctuation maps to foreground-disable (zinc-400) in Future Light, which is faint on white and collides with the comment color. The editor themes intentionally keep zinc-500.
  • Text-mode fields render Apollo's font-mono while Monaco editors (including NodePropertyPanel's inline editor) use the system mono stack, so a value changes font when a field switches into code mode.
  • Foundation color docs (foundation/colors.stories.tsx, foundation/Future/colors.ts, and a few others) still hardcode Tailwind v3 hex.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings September 1, 2026 22:30
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Apollo Coded App preview deployments are ready.

Project Status Preview Updated (PT)
apollo-design Ready Preview · Logs Sep 23, 2026, 05:04:15 PM
apollo-docs Ready Preview · Logs Sep 23, 2026, 05:04:15 PM
apollo-landing Ready Preview · Logs Sep 23, 2026, 05:04:15 PM
apollo-vertex Ready Preview · Logs Sep 23, 2026, 05:04:15 PM

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Dependency License Review

  • ✅ 1937 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1708
ISC 88
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.3.3 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are confirmed issues in Storybook content (em-dash usage) and a LiveMonacoEditor control bug (defaultValue vs value) that can desync demos relying on external state.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Builds out a new Storybook “Patterns > Code Editors” documentation section in apollo-wind, aligns CodeMirror theme tokens with Monaco for Future themes, and refactors a large workbench composition out of a *.stories.tsx file to avoid Storybook CSF auto-detection collisions.

Changes:

  • Added/expanded Storybook pattern pages for Monaco + CodeMirror usage, variable insertion, and a canvas-panel “Layout Pattern” example.
  • Updated CodeMirror Future theme background tokens to match Monaco’s editor.background.
  • Extracted ErrorAndValidationWorkbench into a standalone .tsx module and updated Storybook sorting to include the new Patterns section.
File summaries
File Description
packages/apollo-wind/src/editor-themes/codemirror.ts Aligns Future dark/light CodeMirror background tokens to match Monaco.
packages/apollo-wind/src/components/ui/code-editors.stories.tsx Adds the new “Patterns/Code Editors” documentation pages, demos, and theme previews.
packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx Renames panel editor stories to avoid collisions with the new Code Editors pages.
apps/storybook/src/patterns/LayoutPatterns.stories.tsx Removes the inlined workbench implementation and consumes the extracted component.
apps/storybook/src/patterns/ErrorAndValidationWorkbench.tsx New extracted workbench component used by multiple pattern pages.
apps/storybook/.storybook/preview.tsx Stabilizes sidebar ordering for the new Patterns section.
Review details

Suppressed comments (2)

packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx:1313

  • The Storybook story name uses an em dash character, which is discouraged in Storybook documentation content. Prefer a colon (or similar) separator.
export const CompactEditor: Story = {
  name: 'Panel — Compact Editor',
  render: () => <CompactEditorStory />,

packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx:1525

  • The Storybook story name uses an em dash character, which is discouraged in Storybook documentation content. Prefer a colon (or similar) separator.
export const InputEditor: Story = {
  name: 'Panel — Inline Editor',
  render: () => <InputEditorStory />,
  • Files reviewed: 6/6 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx
Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Storybook visual diff

⚠️ Visual changes detected: 13 changed, 10 added (of 80 compared, 57 unchanged). View report

Baseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs

Updated (PT): Sep 23, 2026, 05:08:54 PM

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage + size by package

Per-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.

Package Coverage New-line coverage Packed (gzip) Unpacked vs main
@uipath/apollo-core — — 42.01 MB 50.16 MB ±0
@uipath/apollo-react 46.1% 0.0% (0/1) 7.73 MB 30.04 MB ±0
@uipath/apollo-ui-icons — — 2.86 MB 6.96 MB ±0
@uipath/apollo-wind 67.4% — (1092 untracked) 470.3 KB 2.97 MB +864 B
@uipath/ap-chat 85.8% — 43.90 MB 56.64 MB ±0

"Coverage" is each package's own coverage.include scope (e.g. apollo-core instruments only scripts/). "Packed"/"Unpacked" come from npm pack --dry-run and only cover built packages — "—" means not measured this run (package not affected / not built). "vs main" is the packed (gzipped) delta against the last successful main build (the package-sizes artifact from the Release workflow); "—" there means no main baseline was available this run. The baseline is main's latest build, not this PR's exact merge-base, so it includes any drift since the branch diverged. Packages with no vitest config are omitted.

Copilot AI review requested due to automatic review settings September 1, 2026 22:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

There are new cross-workspace imports in code-editors.stories.tsx (deep apollo-react source imports and a package→app dependency) that should be corrected/avoided to match repo conventions and reduce coupling.

Review details

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

packages/apollo-wind/src/components/ui/code-editors.stories.tsx:10

  • This story file in packages/apollo-wind imports a component from apps/storybook, creating a package→app dependency that makes the story harder to reuse and can break isolated package typechecks/builds. Consider moving ErrorAndValidationWorkbench into a shared location (e.g., an apollo-react canvas story template) or duplicating the minimal workbench composition locally within this storybook section.

This issue also appears on line 11 of the same file.

packages/apollo-wind/src/components/ui/code-editors.stories.tsx:13

  • These imports reach into apollo-react’s source tree via a relative path. Prefer consuming the public canvas entrypoints (as other Storybook code does) so refactors inside apollo-react don’t silently break this story and to avoid cross-workspace relative coupling.
import { CanvasTakeoverModal } from '../../../../apollo-react/src/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal';
import { NodePropertyPanel } from '../../../../apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel';
import { withCanvasProviders } from '../../../../apollo-react/src/canvas/storybook-utils';
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been stale for over 2 weeks with no new commits. Closing — feel free to reopen if you'd like to continue this work. To keep a PR exempt from this automation, add the do-not-close label.

@github-actions github-actions Bot closed this Sep 21, 2026
@dbacomputer dbacomputer reopened this Sep 23, 2026
Copilot AI review requested due to automatic review settings September 23, 2026 21:22
@dbacomputer dbacomputer changed the title docs(storybook): build out Code Editors pattern pages feat(storybook): build out Code Editors pattern pages Sep 23, 2026
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from 76ab0cc to 9a438ff Compare September 23, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Six moderate findings and two minor nits remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)

Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Comment thread packages/apollo-wind/src/editor-themes/codemirror.ts Outdated
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from 9a438ff to dd0ee27 Compare September 23, 2026 21:37
@dbacomputer
dbacomputer enabled auto-merge (rebase) September 23, 2026 21:38
Copilot AI review requested due to automatic review settings September 23, 2026 21:49
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from dd0ee27 to 2c68548 Compare September 23, 2026 21:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved moderate issues affect takeover scoping, editor accessibility, text-mode editing, and Monaco global configuration.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Medium severity

Open (3)
Resolved since last review (2)

Comment thread packages/apollo-react/src/canvas/stories/templates/Flow.stories.tsx Outdated
Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Copilot AI review requested due to automatic review settings September 23, 2026 22:34
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from 2c68548 to 3b753b7 Compare September 23, 2026 22:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved issues remain in variable insertion state, theme switching, and label focus behavior.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (3)

Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Copilot AI review requested due to automatic review settings September 23, 2026 22:42
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from 3b753b7 to 96bf359 Compare September 23, 2026 22:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Address state loss when switching themes and ensure the lockable editor label focuses the Monaco editor.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (1)

Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx
Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Copilot AI review requested due to automatic review settings September 23, 2026 23:05
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from 96bf359 to fcdd8b7 Compare September 23, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad editor, Storybook, and workbench changes warrant final human review.

Review effort: Lite
Findings: None

Resolved since last review (2)

Copilot AI review requested due to automatic review settings September 23, 2026 23:29
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from fcdd8b7 to b5f14bb Compare September 23, 2026 23:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved moderate issues affect state preservation, editor synchronization, accessibility, and active-line visibility.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)

Comment thread packages/apollo-wind/src/components/ui/code-editors.stories.tsx Outdated
Copilot AI review requested due to automatic review settings September 23, 2026 23:53
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from b5f14bb to cc655ed Compare September 23, 2026 23:53
dbacomputer and others added 2 commits September 23, 2026 16:54
The Future Monaco and CodeMirror themes hardcoded Tailwind v3 hex for
every zinc/cyan/emerald/amber/violet step, while apollo-core ships the
Tailwind v4 values for the same steps (e.g. zinc-400 #a1a1aa vs #9f9fa9,
cyan-400 #22d3ee vs #00d3f2). Snap every Future value to the apollo-core
hex for the step it already names, so the editors match the --code-* and
surface tokens they document. Step choices are unchanged.

Also:
- Future Dark CodeMirror background moves from zinc-900 to zinc-800 to
  match Monaco's editor.background (Future Light already matches at white
  via the promoted surface-overlay token).
- Future Dark Monaco popups (suggest, hover, widget) use surface-overlay
  (zinc-800) instead of zinc-950, the page background, matching Future
  Light. Suggest selected rows use background-selected in both Future
  themes (zinc-700 / zinc-200).
- All six Monaco themes now set suggest widget foregrounds. Without them
  Monaco fell back to its defaults: white text on the Future Light
  selected row (unreadable) and a stock blue match highlight in place of
  each theme's accent.
- All six Monaco themes color bracket pairs with the theme's punctuation
  color instead of Monaco's default gold/orchid/blue, matching CodeMirror,
  and unexpected brackets with error-text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renamed "Editor Full" / "Editor Compact" / "Editor Inline" to
"Panel: Full Editor" / "Panel: Compact Editor" / "Panel: Inline Editor".
These names collided with the new Apollo Wind > Patterns > Code Editors
pages of the same names, which document a different, unrelated set of
Monaco/CodeMirror examples. The collision made both sets of stories hard
to tell apart in search and the sidebar.
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from cc655ed to f2aae0c Compare September 23, 2026 23:54
Adds a full "Apollo Wind > Patterns > Code Editors" documentation section
covering how to compose Monaco and CodeMirror across the app, and fixes
several real bugs surfaced while building it out:

- New pages: Editor Full, Editor Compact, Editor Input, Editor Variables,
  and a canvas-panel Layout Pattern example, alongside the existing
  Overview / Reference Monaco / Reference CodeMirror / Themes pages.
- Editor Variables demonstrates inserting a variable both ways: through
  a VariablePicker "Insert" dropdown and by typing `$` in the editor,
  covering both PromptEditor (ref-based insertVariableToken) and Monaco
  (cursor-position insert via editor.executeEdits, the same pattern
  already used in NodePropertyPanel's panel composition stories).
- Layout Pattern reuses the shared FullWorkbenchComposition template,
  which gains an optional renderRightPanel prop so other pattern pages
  can supply their own panel. Its panel header matches the other
  workbench panels (node icon, no header action). The expression
  takeover uses the same Modal + ModalContent variant="takeover" pattern
  as the shared node takeover (not the deprecated CanvasTakeoverModal),
  opens straight into fullscreen, and has Run in its header as a
  secondary button.
- Input Editor: the lockable-field example mounts Monaco borderless in the
  field's own row, like NodePropertyPanel's inline editor, instead of a
  nested bordered box, and passes a styled Label through the label slot.
  The field's id, aria-*, and data-slot are forwarded to Monaco's focus
  element and the editor is named via ariaLabel, so validation and
  InputGroup focus styling reach it. Clicking the field label focuses the
  editor, since a label can't activate Monaco's EditContext div.
  The Monaco and CodeMirror inputs use the default InputGroup fill and
  share one code-mode treatment (header, no line numbers, wrapping,
  height, type size, Future radius).
- Field Type guidance links its insert-variable section and the matching
  audit rows to Editor Variables for the code editor implementation.
- Fixed: Monaco's TS diagnostics flagged undeclared identifiers in these
  illustrative snippets as errors. Semantic validation is disabled; syntax
  validation stays on so malformed code still surfaces. These TypeScript
  defaults are global to Monaco, so they apply only while a demo editor
  is mounted and the previous defaults are restored afterwards. Models now use a
  unique .tsx URI with JSX enabled, since the full sample is a React
  component and every JSX line was reported as a syntax error.
- Fixed: LiveMonacoEditor forwarded value via defaultValue, so external
  updates to an already-mounted controlled editor were ignored. It is
  now controlled when a caller passes onChange and uncontrolled
  otherwise, so static samples can't reconcile a constant value over
  user edits. The Monaco input and Editor Variables demos keep their
  expression in state, so code-mode edits and inserted variables survive
  re-renders. The CodeMirror editors (the input demo and
  LiveCodeMirrorEditor) rebuild their view on theme changes from the
  live document instead of the original sample or a keyed remount, so
  edits survive a theme switch.
- Fixed: the lockable-field expression editor had a fixed 84px height
  inside a 36px input row, so it overflowed and covered the field label
  above it; it now fills the row and centers one line at any row height.
- Fixed: its placeholder was never wired up, so a cleared field showed
  nothing; it now renders in the same position and font as the built-in
  expression input's placeholder.
- Fixed: CodeMirror's own base styles overrode our theme font-family on
  `.cm-content`, so CodeMirror editors rendered in the browser's generic
  monospace font (visibly larger) instead of Apollo's font stack. The
  rule now inherits from the themed root.
- Fixed: Monaco and CodeMirror examples (Editor Full/Compact, Themes)
  used mismatched heights since CodeMirror auto-sizes to its content;
  both now share an explicit height so side-by-side comparisons line up.
- Storybook sidebar: added "Patterns" > ["Layout Patterns", "Code
  Editors"] to storySort so the new section has a stable position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dbacomputer
dbacomputer force-pushed the code-editors-patterns-docs branch from f2aae0c to 71ffb6a Compare September 23, 2026 23:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The Code Editors story title must be prefixed with Apollo Wind/ so it appears in the intended sidebar section.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 23, 2026 23:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

CodeMirror editors need accessible names for screen readers.

Review effort: Lite
Findings: None

@dbacomputer
dbacomputer merged commit ed19b6c into main Sep 24, 2026
45 checks passed
@dbacomputer
dbacomputer deleted the code-editors-patterns-docs branch September 24, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants